home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmDocument
- Caption = "Form1"
- ClientHeight = 4020
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 7365
- Height = 4425
- Icon = DOCUMENT.FRX:0000
- Left = 1035
- LinkTopic = "Form1"
- MDIChild = -1 'True
- ScaleHeight = 4020
- ScaleWidth = 7365
- Top = 1140
- Width = 7485
- Begin CheckBox chkFileHasChanged
- Caption = "File has changed flag"
- Height = 495
- Left = 1080
- TabIndex = 2
- Top = 2280
- Visible = 0 'False
- Width = 2655
- End
- Begin TextBox txtDocument
- Height = 495
- Left = 0
- MultiLine = -1 'True
- ScrollBars = 3 'Both
- TabIndex = 0
- Top = 0
- Width = 1215
- End
- Begin Label lblFilename
- BorderStyle = 1 'Fixed Single
- Height = 495
- Left = 4440
- TabIndex = 1
- Top = 2280
- Visible = 0 'False
- Width = 1215
- End
- Option Explicit
- Sub Form_Load ()
- ggNumChildren = ggNumChildren + 1
- End Sub
- Sub Form_Resize ()
- Me.txtDocument.Height = Me.ScaleHeight
- Me.txtDocument.Width = Me.ScaleWidth
- End Sub
- Sub Form_Unload (Cancel As Integer)
- Dim msg, Answer
- ' Before ending the program, check
- ' if the current file has changed, and if
- ' it has, give the user a chance to save it.
- If chkFileHasChanged.Value = 1 Then
- msg = lblFilename.Caption + Chr(13)
- msg = msg + "The file has changed." + Chr(13)
- msg = msg + "Do you want to save current changes?"
- Answer = MsgBox(msg, MB_ICONEXCLAMATION + MB_YESNOCANCEL, "Mulitpad")
- If Answer = IDYES Then
- If UCase(lblFilename.Caption) = UCase("Untitled.txt") Then
- If FileSaveAs() = False Then
- Cancel = True
- End If
- Else
- SaveFile
- End If
- End If
- If Answer = IDCANCEL Then
- Cancel = True
- End If
- End If
- ' User did not cancel the Close operation
- If Cancel = False Then
- ggNumChildren = ggNumChildren - 1
- End If
- End Sub
- Sub txtDocument_Change ()
- chkFileHasChanged.Value = 1
- End Sub
-